<template>
  <div id="app">
    <van-tabbar
      v-model="active"
      active-color="#f60"
      inactive-color="#000"
      route
    >
      <van-tabbar-item icon="home-o" to="/Index"> 首页 </van-tabbar-item>
      <van-tabbar-item icon="search" to="/classification">
        分类
      </van-tabbar-item>
      
        <van-tabbar-item icon="shopping-cart-o" to="/cart" :badge="list.length">
          购物车
        </van-tabbar-item>

      <van-tabbar-item icon="friends-o" to="/myfile"> 我的 </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import {mapState} from 'vuex';
export default {
  name: "App",
  data() {
    return {
      active: 0,
    };
  },
  methods: {
    /* firstclick() {
       this.$router.push('/index')
     },
     secondclick() {
       this.$router.push('/cate')
     },
     thirdclick() {
       this.$router.push('/cart')
     },
     fourclick() {
       this.$router.push('/myfile')
     } */
  },
  computed:{
    ...mapState({
      list:state=>state.cart.list
    })
  },
  mounted(){
    console.log(this.list.length);
  }
};
</script>

<style >
</style>